package com.platform.service.impl;

import com.platform.cache.J2CacheUtils;
import com.platform.dao.TeamWithUserDao;
import com.platform.entity.TeamWithUserEntity;
import com.platform.entity.TeamWithUserEntityVO;
import com.platform.service.TeamWithUserService;
import com.platform.util.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 推广管理:团队管理列表
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2019-02-02 18:01:31
 */
@Service("teamWithUserService")
public class TeamWithUserServiceImpl implements TeamWithUserService {
    @Autowired
    private TeamWithUserDao teamWithUserDao;

    @Override
    public TeamWithUserEntity queryObject(Long userId) {
        return teamWithUserDao.queryObject(userId);
    }

    @Override
    public List<TeamWithUserEntity> queryList(Map<String, Object> map) {
        return teamWithUserDao.queryList(map);
    }

    public List<TeamWithUserEntityVO> queryListVO(Map<String, Object> map) {
        return teamWithUserDao.queryListVO(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return teamWithUserDao.queryTotal(map);
    }

    @Override
    public int save(TeamWithUserEntity tTeamWithUser) {
        return teamWithUserDao.save(tTeamWithUser);
    }

    @Override
    public int update(TeamWithUserEntity tTeamWithUser) {
        J2CacheUtils.clear(Constants.REDIS_TEAM_KEY);
        return teamWithUserDao.update(tTeamWithUser);
    }

    @Override
    public int delete(Long userId) {
        return teamWithUserDao.delete(userId);
    }

    @Override
    public int deleteBatch(Long[] userIds) {
        return teamWithUserDao.deleteBatch(userIds);
    }
}
